<?php
        session_start();
        if ($_SESSION['nivel'] == 1){
?>
<!doctype html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Cadastro de Cargo</title>
        <link href="bootstrap/css/bootstrap.css" rel="stylesheet" media="screen">
        <link rel="stylesheet" href="estilo.css">
    </head>
    <body>
        <script src="js/bootstrap.js"></script>
        <a href="/" id="voltar">Voltar</a>
        <div class="container">
            <form class="form-signin" method="POST" action="modelo/modeloCargo">
                <input type="hidden" name="operacao" value="inserir"/>
                <h2 class="form-signin-heading">Cadastrar Cargo</h2>
                <input type="text" class="input-block-level" name="nome_cargo" placeholder="Cargo" required="required" >        
                <input class="btn btn-large btn-primary" value="Salvar" type="submit" />
            </form>
            
                
                     <h3 class="form-signin-heading" align="center">Cargos cadastrados</h3>
                <?php

                    include_once 'funcoes.php';
                    $cargos = getCargo($_SESSION['idEmpresa']);
                    $numCargos = mysql_num_rows($cargos);
                        for ($i=0;$i<$numCargos;$i++)
                        {
                            mysql_data_seek($arrayCargos, $i);
                            $arrayCargos = mysql_fetch_array($cargos);
                            echo '<div align="center"><form  method="POST" action="modelo/modeloCargo">
                                  <input type="hidden" name="operacao" value="alterar"/>';
                            echo '<input type="text" name="nome_cargo" value="'.$arrayCargos['nome_cargo'].'" size="22" required="required" />';
                            echo '<input type="hidden" name="id_cargo" value="'.$arrayCargos['id_cargo'].'"/>';
                            echo '&nbsp;&nbsp;<input class="btn btn-large btn-primary" value="Alterar" type="submit" />';
                            echo '</form></div>';
                        }
                    
                ?>
                
        </div> <!-- /container -->
    </body>
</html>
<?php
        }
          else {
        header ('Location: login.html');
    }
?>